package interfacePaxos;

import java.util.Set;

public class Utils {
  /**
   * @param <E>
   *          what we're comparing
   * @param subset
   * @param superset
   * @return whether size(subset) > size(superset) / 2
   */
  public static <E> boolean isMajorityOf(Set<E> subset, Set<E> superset) {
    return isMajorityOf(subset.size(), superset.size());
  }

  /**
   * 
   * @param count
   * @param totalCount
   * @return whether count > totalCount / 2
   */
  public static boolean isMajorityOf(int count, int totalCount) {
    return (count > totalCount / 2);
  }
}
